<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>打印预览</title>
<link rel="stylesheet" href="common/amazeui/css/amazeui.min.css" />
<script src="common/amazeui/js/jquery.min.js"></script>
<script src="common/amazeui/js/amazeui.min.js"></script>
<script src="common/echarts/echarts.min.js"></script>
</head>
<body >
<div id="main" style="height:400px;"></div>
<hr>

<div id="main2" style="height:400px;"></div>
 <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        option = {
        	    
        	    tooltip : {
        	        trigger: 'item',
        	        formatter: "{a} <br/>{b} : {c} ({d}%)"
        	    },
        	    legend: {
        	        orient: 'vertical',
        	        left: 'left',
        	        data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
        	    },
        	    series : [
        	        {
        	            name: '访问来源',
        	            type: 'pie',
        	            radius : '55%',
        	            center: ['50%', '60%'],
        	            data:[
        	                {value:335, name:'直接访问'},
        	                {value:310, name:'邮件营销'},
        	                {value:234, name:'联盟广告'},
        	                {value:135, name:'视频广告'},
        	                {value:1548, name:'搜索引擎'}
        	            ],
        	            itemStyle: {
        	                emphasis: {
        	                    shadowBlur: 10,
        	                    shadowOffsetX: 0,
        	                    shadowColor: 'rgba(0, 0, 0, 0.5)'
        	                }
        	            }
        	        }
        	    ]
        	};

        
          myChart.setOption(option);


          var myChart2 = echarts.init(document.getElementById('main2'));
          myChart2.showLoading();
          $.get('api/echarts/analysis?p=1&q=1').done(function (data) {
              myChart2.hideLoading();
              myChart2.setOption(data.option);
          });
        
    </script>

</body>
</html>